@abstract
class_name State
extends Node

# 新的状态基类 - 统一的状态接口

signal state_changed(from_state: String, to_state: String)

var state_machine: StateMachine
var character: Character
var state_name: String
var animation: AnimationPlayer

# 状态生命周期方法
@abstract func enter(data: Dictionary = {}) -> void
@abstract func exit() -> void
@abstract func update(delta: float) -> void
@abstract func physics_update(delta: float) -> void

# 初始化状态
func initialize(sm: StateMachine, owner_character: Character, _name: String, animation_player: AnimationPlayer) -> void:
	state_machine = sm
	character = owner_character
	state_name = _name
	animation = animation_player

# 请求状态转换
func change_state(new_state: String, data: Dictionary = {}) -> void:
	if state_machine:
		state_machine.change_state(new_state, data)

# 获取状态数据
func get_state_data() -> Dictionary:
	return {}

# 检查是否可以转换到指定状态
func can_transition_to(_target_state: String) -> bool:
	return true  # 默认允许所有转换，子类可以重写

# 状态调试信息
func get_debug_info() -> String:
	return "State: %s" % state_name
